Skip to content

document CURSOR WITH HOLD #19590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2025
Merged

document CURSOR WITH HOLD #19590

merged 4 commits into from
May 9, 2025

Conversation

taroface
Copy link
Contributor

@taroface taroface commented May 7, 2025

@taroface taroface requested review from dikshant and DrewKimball May 7, 2025 21:15
Copy link

github-actions bot commented May 7, 2025

Files changed:

Copy link

netlify bot commented May 7, 2025

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit 54fa73b
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-api-docs/deploys/681e43b17da3c400086020d4

Copy link

netlify bot commented May 7, 2025

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit 54fa73b
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-interactivetutorials-docs/deploys/681e43b145595d0008a06d69

@taroface
Copy link
Contributor Author

taroface commented May 7, 2025

@DrewKimball @dikshant I also want to update the CURSOR sql diagram in a separate cockroach PR so that it exposes WITH HOLD. Should WITHOUT HOLD also be exposed in the diagram?

Copy link

netlify bot commented May 7, 2025

Netlify Preview

Name Link
🔨 Latest commit 54fa73b
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-docs/deploys/681e43b1184a240008fe0e00
😎 Deploy Preview https://deploy-preview-19590--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@DrewKimball
Copy link

@DrewKimball @dikshant I also want to update the CURSOR sql diagram in a separate cockroach PR so that it exposes WITH HOLD. Should WITHOUT HOLD also be exposed in the diagram?

Yes, I think so.

Copy link

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taroface taroface requested a review from florence-crl May 8, 2025 19:46
Copy link
Contributor

@florence-crl florence-crl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 point of confusion that may need clarification.

~~~
</section>

Declare a cursor using `WITH HOLD` to keep it open after the `COMMIT`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Implicit section, it is confusing to see "to keep it open after the COMMIT". In the implicit example, each statement is an implicit transaction and has its own implicit commit. There is no actual COMMIT command listed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That reminds me of some other details that may be worth mentioning - if a transaction aborts, all cursors opened within that txn are also rolled back. However, holdable cursors from previously committed transactions remain open. In addition, if a holdable cursor results in an error as it's being persisted, it will cause the current txn (implicit or explicit) to be rolled back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks both! Incorporated these changes.

craig bot pushed a commit to cockroachdb/cockroach that referenced this pull request May 9, 2025
146458: docgen: expose WITH/WITHOUT HOLD syntax in SQL cursor diagram r=DrewKimball a=taroface

This PR exposes the WITH HOLD / WITHOUT HOLD syntax in the DECLARE ... CURSOR diagram as follows:

<img width="903" alt="image" src="https://github.com/user-attachments/assets/92c448fa-143b-47bb-aa8a-38b68542e123" />

Relates to cockroachdb/docs#19590. 

Epic: none
Release note: none
Release justification: non-production code change

Co-authored-by: Ryan Kuo <[email protected]>
Copy link
Contributor

@florence-crl florence-crl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@taroface taroface enabled auto-merge (squash) May 9, 2025 18:04
@taroface taroface merged commit 8a58d13 into main May 9, 2025
6 checks passed
@taroface taroface deleted the cursor-with-hold branch May 9, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants